package com.wpre.booksystem.enums;

import lombok.Getter;

import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2024-11-15
 * Time: 15:45
 */

//图书状态的枚举
@Getter
public enum BookStatusEnum {
    DELETED(0, "删除"),//删除
    NORMAL(1, "可借阅"),//可借阅
    FORBIDDEN(2, "不可借阅");//不可借阅
    private final Integer code;
    private final String status;

    BookStatusEnum(Integer code, String status) {
        this.code = code;
        this.status = status;
    }

//    public static BookStatusEnum getStatusByCode(Integer code) {
//
////        if (code == 0) {
////            return BookStatusEnum.DELETE;
////        } else if (code == 1) {
////            return BookStatusEnum.NORMAL;
////        } else {
////            return BookStatusEnum.FORBIDDEN;
////        }
//
//        return Arrays.stream(BookStatusEnum.values()).filter(status -> status.getCode() == code).findFirst().get();
//
//    }
}
